<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../js/jquery/jquery-3.4.1.min.js"></script>
    <script src="../../js/validate/validate.js"></script>
</head>
<body>
<input type="file" id="file">
<span>1</span>
<input type="button" value="上传" onclick="testUpload()">
<script>
    function testUpload() {
        var formData = new FormData();
        if (!isImage($('#file'))) {
            return;
        }
        formData.append('file', $('#file')[0].files[0]);
        formData.append('test', $("span").text());
        $.ajax({
            "url":"/upload/upload",
            "type":"POST",
            "data":formData,
            "processData": false,
            "contentType": false,
            "success": function (result) {
                alert(result);
            }
        })
    }
</script>
</body>
</html>